package com.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.pojo.pms.Pms_Category;
import com.shop.vo.CatalogByTree;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//商品分类
public interface Pms_Category_Mapper extends BaseMapper<Pms_Category> {

@Select("select cat_id as id, `name` as title, parent_cid,cat_level,show_status,icon from pms_category")
    public List<CatalogByTree> getTree();//后端管理的layui管理商品分类的tree

    @Select("select pc.cat_id as id, pc.name as title, pc.parent_cid,pc.cat_level,pc.show_status,pc.icon,GROUP_CONCAT(pb.name) as brandName,GROUP_CONCAT(pb.brand_id) as brandId from pms_category as pc left join pms_category_brand_relation as pcbr on pc.cat_id=pcbr.catelog_id left join pms_brand pb on pb.brand_id=pcbr.brand_id GROUP BY pc.cat_id")
    public List<CatalogByTree> getHomeTree();//前台首页展示的




}
